]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/system: Add separate 'Restart' item
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 1 Jul 2020 15:15:48 +0000 (17:15 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Mon, 10 Aug 2020 15:36:26 +0000 (15:36 +0000)
A side effect of removing the action buttons in favor of a regular
submenu is that we are a lot less constrained by size. So instead
of lumping "Restart" in with "Power Off", make it a separate menu
item.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2202

js/ui/status/system.js

index c5673913e4b015a36251d4f7e83444d268c49031..6f71109c52796550aa4909d9fdfa5fe2113e025a 100644 (file)
@@ -27,6 +27,8 @@ class Indicator extends PanelMenu.SystemIndicator {
             () => this._updateSessionSubMenu());
         this._powerOffItem.connect('notify::visible',
             () => this._updateSessionSubMenu());
+        this._restartItem.connect('notify::visible',
+            () => this._updateSessionSubMenu());
         // Whether shutdown is available or not depends on both lockdown
         // settings (disable-log-out) and Polkit policy - the latter doesn't
         // notify, so we update the menu item each time the menu opens or
@@ -52,6 +54,7 @@ class Indicator extends PanelMenu.SystemIndicator {
             this._loginScreenItem.visible ||
             this._logoutItem.visible ||
             this._suspendItem.visible ||
+            this._restartItem.visible ||
             this._powerOffItem.visible;
     }
 
@@ -124,6 +127,17 @@ class Indicator extends PanelMenu.SystemIndicator {
             this._suspendItem, 'visible',
             bindFlags);
 
+        item = new PopupMenu.PopupMenuItem(_('Restart…'));
+        item.connect('activate', () => {
+            this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
+            this._systemActions.activateRestart();
+        });
+        this._sessionSubMenu.menu.addMenuItem(item);
+        this._restartItem = item;
+        this._systemActions.bind_property('can-restart',
+            this._restartItem, 'visible',
+            bindFlags);
+
         item = new PopupMenu.PopupMenuItem(_('Power Off…'));
         item.connect('activate', () => {
             this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);